(() => {
  let cpnName = "testCpn";

  window[cpnName] = Vue.extend({
    // el:'',//不可以写el,因为最终都是为vm实例对象选择的容器服务
    // 模板代码
    template: `
    <div>
      <h2>我是值：{{val}}</h2>
      <button @click="add(step)">我是按钮 +1</button>
      <button @click="sub(step)">我是按钮 -1</button>
    </div>
  `,
    data() {
      return {
        val: 0,
        step: 1,
      };
    },
    methods: {
      add(step = this.step) {
        this.val += step;
      },
      sub(step = this.step) {
        this.val -= step;
      },
    },
  });
})();
